const { Schema, model, Types } = require("mongoose");

const userSchema = new Schema({
  userId: {
    default: () => new Types.ObjectId(),
    type: Types.ObjectId,
    unique: true
  },
  username: {
    type: String,
    required: true,
    max: 12,
    unique: true,
  },
  password: {
    type: String,
    required: true,
    max: 18,
  },
  avatar: {
    type: Types.ObjectId,
    ref: 'Avatar'
  }
});

module.exports.UserModel = model("User", userSchema);
